﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ERP.Manager.DataProvider;
using ERP.Manager.DataEntity;
namespace ERP.Manager.BusinessServices
{
    public class ECS_goods_attrinfoServices
    {
        private readonly IECS_goods_attrinfoRepository ecs_goods_attrinforepository;
        public ECS_goods_attrinfoServices() { }
        public ECS_goods_attrinfoServices(IECS_goods_attrinfoRepository ecs_goods_attrinforepository)
        {
            this.ecs_goods_attrinforepository = ecs_goods_attrinforepository;
        }

        #region 根据商品编号查询商品属性
        public List<ECS_goods_attrinfo> all_ecs_goods_attrinfo(int goods_id)
        {
            return ecs_goods_attrinforepository.all_ecs_goods_attrinfo(goods_id);
        }
        #endregion

        #region 添加商品类型属性
        public int add_ecs_goods_attrinfo(ECS_goods_attrinfo ecs_goods_attr)
        {
            return ecs_goods_attrinforepository.add_ecs_goods_attrinfo(ecs_goods_attr);
        }
        #endregion

        public ECS_goods_attrinfo all_ecs_goods_attrinfo_attr_id(int goods_id, int attr_id)
        {
            return ecs_goods_attrinforepository.all_ecs_goods_attrinfo(goods_id).Find(ecs_goods_attr => ecs_goods_attr.ecsattributeinfo.attr_id == attr_id);
        }

        #region 修改商品类型属性
        public int update_ecs_goods_attrinfo(ECS_goods_attrinfo ecs_goods_attr)
        {
            return ecs_goods_attrinforepository.update_ecs_goods_attrinfo(ecs_goods_attr);
        }
        #endregion
        #region 删除商品类型属性
        public int delete_ecs_goods_attrinfo(int goods_id)
        {
            return ecs_goods_attrinforepository.delete_ecs_goods_attrinfo(goods_id);
        }
        #endregion
    }
}
